import * as Types from "@/api/system/types";
import request from "@/utils/request";
import {SysMessagePostReq} from "@/api/system/types";
import {AxiosResponse} from "axios";

//查询用户私信会话列表
export async function querySysMessageSession(userId: number): Promise<Types.SysMessageSessionResp[]> {
    return request.get('/system/message/session/list?userId=' + userId)
}
//查询用户私信会话对话列表
export async function querySysMessageSessionChat(sessionId: number): Promise<Types.SysMessageSessionChatResp> {
    return request.get('/system/message/session/chat?sessionId=' + sessionId)
}
export async function querySysMessageSessionChatByToUser(toUserId: number): Promise<Types.SysMessageSessionChatResp> {
    return request.get('/system/message/session/chat/toUser?toUserId=' + toUserId)
}
//发送私信
export async function postMessage(req: Types.SysMessagePostReq): Promise<Types.SysMessageSessionChatResp> {
    return request.post('/system/message/post', req)
}
//请求图形验证码
export async function reqCaptcha(captchaKey: string): Promise<AxiosResponse> {
    return request.request({url: '/system/captcha?captchaKey=' + captchaKey, responseType: 'blob'})
}
